<!doctype html>
<html lang="en">
	<head>
		<title>JavaScript Patterns</title>
		<meta charset="utf-8">
	</head>
	<body>
		<script>
			/* Title: Number Conversions with parseInt()
			 Description: use the second radix parameter
			 */

			// pattern 1
			/* NOTE: in this example, if you omit the radix parameter like parseInt(year), the returned value will be 0,
			 * because "09" assumes octal number (as if you did parseInt( year, 8 )) and 09 is not a valid digit in base 8.
			 */

			var month = "06",
					year = "09";
			month = parseInt(month, 10);
			year = parseInt(year, 10);


			// pattern 2
			/* NOTE: if you're expecting input such as “08 hello”, parseInt() will return a number, whereas the others will fail
			 * with NaN.
			 */
			+"08" // result is 8
			Number("08") // 8


			// References
			// http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/
		</script>
	</body>
</html>